//****************************************************************/
//Creation History
// Company: GZ office
// NAME:    SysParamBean.java
// TITLE:   System parameter 
// BY:      Oscar Bai
// DATE:    2003-03-04
//******************************************************************/
//Modification History
//******************************************************************/
//******************************************************************/

package admin.system.sysparam;

import javax.servlet.*;
import javax.servlet.http.*;

import java.io.*;
import java.sql.*;

import com.ffpc.servlet.*;
import com.ffpc.sql.*;
import com.ffpc.struts.StrutsMessage;

public class SysParamSearch
  extends DBServlet {

  @Override
protected String perform(  HttpServletRequest request,
                             HttpServletResponse response,
                             StrutsMessage message)
    throws  ServletException,
            IOException,
            SQLException,
            DataException,
            Exception
  {
      SysParamBean sysParam = SysParamProcess.createBean();
      sysParam.setSys_Param_name(request.getParameter("sys_param_name"));
      sysParam.setSys_Param_value(request.getParameter("sys_param_value"));
      sysParam.setSys_Param_des(request.getParameter("sys_param_des"));

      SysParamBean[] sysParams = SysParamProcess.find(this.getConnection(),sysParam);

      if (sysParams==null || sysParams.length==0)
      {
          message.setMessage("No record, please input another criteria.");
          return "system/SysParamSearch.jsp";
      }
      else if (sysParams.length==1)
      {
          request.setAttribute("sysParams",sysParams[0]);
          return "system/SysParam.jsp?formAction=Update";
      }
      else
      {
          request.setAttribute("sysParams",sysParams);
          return "system/SysParamList.jsp";
      }
  }
}


